#coding=gb2312
import win32com.client
from win32com.client import Dispatch, constants
 
#Launch or Connect to Microsoft Word.
#I set Visible = True so you don't have to
#go into the task manager to close it if something
#goes wrong
MSWord = win32com.client.Dispatch("Word.Application")
MSWord.Visible = True
 
#Get the Active Document (Last one you had selected)
Document = MSWord.ActiveDocument

Document.Repaginate()

print Document.BuiltInDocumentProperties(constants.wdPropertyPages)
#Iterate through the paragraphs printing them.
for paragraph in Document.Paragraphs:
    Text = paragraph.Range.Text
    #print Text